package com.hzxy.yiyid.web.module.repository.entity;

import com.hzxy.yiyid.web.common.constants.YiyidConstants;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @ClassName SymptomDo
 * @Description 症状
 * @Author RAICOM2023
 * @Date 2023/4/28 21:22
 * @Version 1.0
 **/
@Data
@Entity
@Table(name = "yiyi_symptom")
public class SymptomDo implements Serializable {
    private static final long serialVersionUID = 2716764690371481275L;

    @Id
    @Column(name = "symptom_id")
    @GenericGenerator(
            name = "generator_yiyi_symptom",
            strategy = "org.hibernate.id.enhanced.SequenceStyleGenerator",
            parameters = {
                    @Parameter(name = "sequence_name", value = "s_yiyi_symptom"),
                    @Parameter(name = "initial_value", value = "1"),
                    @Parameter(name = "increment_size", value = "1")
            }
    )
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "generator_yiyi_symptom")
    private Long symptomId;

    /**
     * 症状编号
     */
    @Column(name = "symptom_number")
    private String symptomNumber;

    /**
     * 症状名称
     */
    @Column(name = "symptom_name")
    private String symptomName;

    /**
     * 对应疾病名称
     */
    @ElementCollection(targetClass=String.class)
    @Column(name = "disease_name")
    private List<String> diseaseName = new ArrayList<String>();

    /**
     * 对应疾病编号
     */
    @ElementCollection(targetClass=String.class)
    @Column(name = "disease_number")
    private List<String> diseaseNumber = new ArrayList<String>();

    /**
     * 保存时间
     */
    @Column(name = "save_time")
    @DateTimeFormat(pattern = YiyidConstants.DATE_FORMAT_DEFAULT_VIEW)
    private Date saveTime = new Date();;

    /**
     * 修改时间
     */
    @Column(name = "update_time")
    @DateTimeFormat(pattern = YiyidConstants.DATE_FORMAT_DEFAULT_VIEW)
    private Date updateTime;
}
